package com.siteseat.common.deploy;

import java.util.List;

import com.siteseat.common.foundation.Component;
import com.siteseat.common.foundation.PropertyHelper;

/**
 * @author yqiang
 */
public class DeployTransfer extends Component {

  private List<Deployer> deployers;
  
  private DeployScheduler scheduler;
  
  /**
   * Gets the deployers
   *
   * @return the deployers
   */
  public List<Deployer> getDeployers() {
    return deployers;
  }

  /**
   * Sets the deployers
   *
   * @param deployers the deployers to set
   */
  public void setDeployers( List<Deployer> deployers ) {
    this.deployers = deployers;
  }

  /**
   * Gets the scheduler
   *
   * @return the scheduler
   */
  public DeployScheduler getScheduler() {
    return scheduler;
  }

  /**
   * Sets the scheduler
   *
   * @param scheduler the scheduler to set
   */
  public void setScheduler( DeployScheduler scheduler ) {
    this.scheduler = scheduler;
  }

  /**
   * {@inheritDoc}
   */
  @Override
  protected void doDestroy() throws Exception {
  }

  /**
   * {@inheritDoc}
   */
  @Override
  protected void doInit() throws Exception {
    DeployScheduler s = getScheduler();
    PropertyHelper.ensureInitialized( log, s, "scheduler" );
    
    List<Deployer> t = getDeployers();
    PropertyHelper.ensureInitialized( log, t, "deployers" );
    
    s.addDeployers( t );
  }
  
}
